package JavaSE.StreamLearning.OutputNoSuffix;

import java.io.*;

/**
 *  测试 通过序列化流到没有后缀的文件 然后通过反序列化流读取文件中的对象信息
 */
public class NoSuffix {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        Person p = new Person(18, "枫");
        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("src\\JavaSE.StreamLearning.OutputNoSuffix\\a"));
        oos.writeObject(p);
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("src\\JavaSE.StreamLearning.OutputNoSuffix\\a"));
        Object get = ois.readObject();
        System.out.println(get);

    }
}

class Person implements Serializable {
    int age;
    String name;
    Person(int age, String name ) {
        this.age = age;
        this.name = name;
    }
}
